home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2743 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  969 b 

  1. Path: news.dtd.com!usenet
  2. From: Neil Radisch <nradisch@dtd.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: On Exception handling.....from a newbie
  5. Date: Fri, 19 Jan 1996 08:04:16 -0500
  6. Organization: Downtown Ditial
  7. Message-ID: <30FF96D0.6BC7@dtd.com>
  8. References: <1996Jan15.013336.4730@sfov1.verifone.com> <4ddpjh$3au@dawn.mmm.com>
  9. NNTP-Posting-Host: sungod.dtd.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b5 (X11; I; SunOS 5.3 sun4m)
  14.  
  15. That's legal??!!??
  16.  
  17.  
  18. > How about this?
  19. >     bool retry = true;
  20. >     while (retry) {
  21. >         AutoFileCloser autoCloser;
  22. >         try {
  23. >             open file;
  24. >             autoCloser.manage(something); // give "handle" to autoCloser
  25. >             read the blocks;
  26. >             retry = false;
  27. >         } catch (OpenFileException e) {
  28. >         } catch (ReadFileException e) {
  29. >         }
  30. >         // autoCloser closes file here, if necessary
  31. >     }
  32. >
  33.